home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / State.as < prev    next >
Text File  |  2013-04-24  |  1KB  |  58 lines

  1. class State
  2. {
  3.    function State(_mcRef, _bNormal)
  4.    {
  5.       this.mcRef = _mcRef;
  6.       this.sState = "";
  7.       if(_bNormal == false)
  8.       {
  9.          if(MainBroadcaster.Instance == null)
  10.          {
  11.             var _loc4_ = new MainBroadcaster();
  12.          }
  13.          MainBroadcaster.Instance.doAddListener(this);
  14.       }
  15.       else
  16.       {
  17.          if(Broadcaster.Instance == null)
  18.          {
  19.             var _loc5_ = new Broadcaster();
  20.          }
  21.          Broadcaster.Instance.doAddListener(this);
  22.       }
  23.    }
  24.    function cleanUp()
  25.    {
  26.       Broadcaster.Instance.doRemoveListener(this);
  27.    }
  28.    function doAction()
  29.    {
  30.       this[this.sState]();
  31.    }
  32.    function setState(_sState)
  33.    {
  34.       if(this.sState != _sState)
  35.       {
  36.          this.sState = _sState;
  37.          this.mcRef.gotoAndStop(_sState);
  38.       }
  39.    }
  40.    function doPause()
  41.    {
  42.       this.mcRef.mcState.stop();
  43.    }
  44.    function doUnPause()
  45.    {
  46.       this.mcRef.mcState.play();
  47.    }
  48.    function stateFinished()
  49.    {
  50.       var _loc2_ = false;
  51.       if(this.mcRef.mcState._currentframe >= this.mcRef.mcState._totalframes)
  52.       {
  53.          _loc2_ = true;
  54.       }
  55.       return _loc2_;
  56.    }
  57. }
  58.